package com.foton.logistic.view.city;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelper extends SQLiteOpenHelper {
	// 类没有实例化,是不能用作父类构造器的参数,必须声明为静态
	private static final String name = "ifoton_city"; // 数据库名称
	private static final int version = 1; // 数据库版本

	public DatabaseHelper(Context context) {
		super(context, name, null, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		Log.e("info", "create table");
		db.execSQL("CREATE TABLE IF NOT EXISTS `ifoton_city` ( " +
				"  `INDEXS` varchar(255) primary key COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `CODE` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `KIND` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `MDMNUMCODE` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `AREACODE` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `AREANAME` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `PROVCODE` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `MDMPROVNUM` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `MDMPROVNAME` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `CITYCODE` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `MDMCITYNUM` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `MDMCITYNAME` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `TOWNCODE` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `MDMTOWNNUM` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `MDMTOWNNAME` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `MDMAREA` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, " +
				"  `REMARK` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL " +
				") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	}
}
